package com.android.common.mvp.view.activity;

import android.os.Bundle;
import android.view.WindowManager;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentTransaction;
import com.android.common.R;
import com.android.common.base.BaseActivity;
import com.android.common.mvp.view.fragment.VideoPlayFragment;
import com.shuyu.gsyvideoplayer.GSYVideoManager;

/**
 * 视频播放页面
 */
public class VideoPlayActivity extends BaseActivity {

    @Override
    protected int onSetRootViewId() {
        return R.layout.common_content;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //去除状态栏
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

    @Override
    protected void onInitFragment() {
        super.onInitFragment();
        VideoPlayFragment fragment = new VideoPlayFragment();
        fragment.setArguments(mBundle);
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.add(R.id.fl_content, fragment);
        ft.commit();
    }

    @Override
    public void onBackPressed() {
        if (GSYVideoManager.backFromWindowFull(this)) {
            return;
        }
        super.onBackPressed();
    }
}